/*导航开始*/
// 一级导航
var span = document.getElementsByClassName("nav_sp")[0];
var cur = document.getElementsByClassName("cur");
var sNav = document.getElementsByClassName("sNav")[0];
var nava = document.getElementsByClassName("nav_a");
var lis = document.getElementsByClassName("nav_item");
for (var i = 1; i < lis.length; i++) {
	lis[i].index = i;
	lis[i].onmouseover = function () {
		sNav.style.top = "80px";
		nava[this.index - 1].style.color = "#ff5252";
		lis[this.index].style.borderBottom = "2px solid #ff5252";
		cur[this.index - 1].style.background = 'url(img/00-menu-hover-bg.png) repeat-X';
	}
	lis[i].onmouseout = function () {
		sNav.style.top = "-430px";
		nava[this.index - 1].style.color = "#333333"
		lis[this.index].style.borderBottom = "none";
		cur[this.index - 1].style.background = 'none';
	}
	sNav.onmouseover = function () {
		sNav.style.top = "80px";
	}
	sNav.onmouseout = function () {
		sNav.style.top = "-430px";
	}
	lis[0].onmouseover = function () {
		sNav.style.top = "80px";
		lis[0].style.borderBottom = "2px solid #ff5252"
		span.style.color = "#ff5252";
	}
	lis[0].onmouseout = function () {
		sNav.style.top = "-430px";
		lis[0].style.borderBottom = "none";
		span.style.color = "#333333";
	}
}
// 二级导航
var ic1 = document.getElementsByClassName("ic1");
for (var i = 0; i < cur.length; i++) {
	cur[i].index = i
	cur[i].onmouseover = function () {
		nava[this.index].style.color = "#ff5252";
		lis[this.index + 1].style.borderBottom = "2px solid #ff5252";
		cur[this.index].style.background = 'url(img/00-menu-hover-bg.png) repeat-X';
	}
	cur[i].onmouseout = function () {
		nava[this.index].style.color = "#333333";
		lis[this.index + 1].style.borderBottom = "none";
		cur[this.index].style.background = 'none';
	}
}
for (var i = 0; i < ic1.length; i++) {
	ic1[i].index = i
	ic1[i].onmouseover = function () {
		ic1[this.index].style.backgroundColor = "#f5f6f7"
	}
	ic1[i].onmouseout = function () {
		ic1[this.index].style.background = "none"
	}
}
/*导航结束 */
// 小二级导航
var t1 = document.getElementsByClassName("t1_1")[0];
var t2 = document.getElementsByClassName("t1_2")[0];
t2.onmouseover = function () {
	t1.setAttribute("class", "t1_1")
	t2.setAttribute("class", "t1_2 on")
	item1.style.marginLeft = '-834px';
}
t1.onmouseover = function () {
	t1.setAttribute("class", "t1_1 on")
	t2.setAttribute("class", "t1_2")
	item1.style.marginLeft = '0px';
}
// 鼠标滚动
var li5 = document.getElementsByClassName('li5')[0];
var header = document.getElementById('header');
li5.onclick = function () {
	window.scroll(0, 0);
}
var pageY = 0
window.onscroll = function () {
	if (window.pageYOffset > pageY) {
		header.style.opacity = '1';
		pageY = window.pageYOffset
	} else if (window.pageYOffset < pageY) {
		if (window.scrollY <= 80) {
			header.style.opacity = '1';
		} else {
			header.style.opacity = '0';
			sNav.style.top = "-430px"
		}
		pageY = window.pageYOffset
	}
}
// 轮播图
var imgItmes = document.querySelectorAll("#imgwrap li");
var pagesItmes = document.querySelectorAll(".pages-container li");
var main = document.getElementById("main");
var box1 = document.getElementById("box1")
main.currentIndex = 0;
for (var i = 0; i < pagesItmes.length; i++) {
	(function (i) {
		pagesItmes[i].onmouseenter = function () {
			// 记录当前显示的图片的索引
			main.currentIndex = i

			// 对小圆点执行排他法
			setActive(pagesItmes, i)

			// 对图片排他
			setActive(imgItmes, i)
		}
	})(i)
}
// 第一个参数 ：所有的li节点
// 第二个参数：当前要激活的节点的索引
function setActive(items, current) {
	// 清空所有li的类名
	for (var i = 0; i < items.length; i++) {
		items[i].className = ""
	}
	// 设置当前要激活的那个元素的类名
	items[current].className = "active"
}
function nextPage() {
	// 没有到最后一张
	// 当前的索引 < 最后一张  0<2
	if (main.currentIndex < pagesItmes.length - 1) {
		// 计算下一张图片的索引
		main.currentIndex += 1
		// 对小圆点执行排他法
		setActive(pagesItmes, main.currentIndex)

		// 对图片排他
		setActive(imgItmes, main.currentIndex)
	} else {
		// 到最后一张,跳到第一张
		// 计算下一张图片的索引
		main.currentIndex = 0
		// 对小圆点执行排他法
		setActive(pagesItmes, main.currentIndex)

		// 对图片排他
		setActive(imgItmes, main.currentIndex)
	}

}
set = setInterval(function () {
	nextPage()
}, 3000)
box1.onmouseover = function () {
	clearInterval(set)
}
box1.onmouseout = function () {
	set = setInterval(function () {
		nextPage()
	}, 3000)
}
//内容栏二
var dl = document.getElementsByClassName('dl');
var item1 = document.getElementsByClassName("item_1")[0];
var item2 = document.getElementsByClassName("item_2")[0];
for (var i = 0; i < dl.length; i++) {
	dl[i].index = i;
	dl[i].onmouseenter = function () {
		for (var j = 0; j < this.parentNode.children.length; j++) {
			this.parentNode.children[j].setAttribute('class', 'dl');
		}
		dl[this.index].setAttribute('class', 'dl hover');
	}
}
//内容栏四图片切换
var li1 = document.getElementsByClassName('li_1');
var li2 = document.getElementsByClassName('li_2');
var sec4 = document.getElementById("section4");
var num = [
	'url(./img/3f-img1.jpg) center center no-repeat',
	'url(./img/3f-img2.jpg) center center no-repeat',
	'url(./img/3f-img3.jpg) center center no-repeat',
	'url(./img/3f-img4.jpg) center center no-repeat',
	'url(./img/3f-img5.jpg) center center no-repeat',
	'url(./img/3f-img6.jpg) center center no-repeat',
];
li2[0].style.zIndex = '2'
for (var i = 0; i < li1.length; i++) {
	li1[i].index = i
	li1[i].onmouseenter = function () {
		for (var j = 0; j < this.parentNode.children.length; j++) {
			this.parentNode.children[j].setAttribute('class', 'li_1');
		}
		this.setAttribute('class', 'li_1 on');
		for (var i = 0; i < li2.length; i++) {
			for (var j = 0; j < li2.length; j++) {
				li2[j].style.opacity = '0'
				li2[j].style.zIndex = '1'
			}
		}
		li2[this.index].style.opacity = '1'
		li2[this.index].style.zIndex = '2'
		sec4.style.background = num[this.index];
	}
}

// 内容栏六
var list = document.getElementsByClassName("li_list");
var sec6 = document.getElementById("section6");
var li3 = document.getElementsByClassName("li_3");
list[0].style.opacity = '1'
list[0].style.zIndex = 2;
for (var i = 0; i < li3.length; i++) {
	li3[i].index = i
	li3[i].onmouseenter = function () {
		for (var j = 0; j < li3.length; j++) {
			li3[j].className = 'li_3';
			list[j].style.opacity = '0'
			list[j].style.zIndex = '1'
		}
		this.setAttribute('class', 'li_3 on');
		list[this.index].style.opacity = '1'
		list[this.index].style.zIndex = '2'
	}
}


// 底部数字特效
var list1 = document.querySelector(".container10 .list");
document.onscroll = function () {
	if (window.pageYOffset > 6186) {
		list1.className = "list"
	}
}
// 底部展开栏
var icon = document.getElementsByClassName("icon_friend_sh")[0];
var ft = document.getElementsByClassName("ft_friend")[0];
var sp = document.getElementById("sp");
sp.style.fontSize = "16px"
var on = true;
icon.onclick = function () {
	if (on) {
		ft.className = "ft_friend top ft_on";

	} else {
		ft.className = "ft_friend";
	}
	on = !on
}
// 底部栏删除键
var closes = document.getElementsByClassName("close")[0];
var btmfloat = document.getElementsByClassName('bottom_float')[0];
closes.onclick = function () {
	btmfloat.style.display = 'none';
}








